package net.lijingye.education.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * Created by LijingYe on 2016/4/4.
 */
@Entity
@Table(name = "topic")
public class Topic implements Serializable {
    @Id
    @Column(name = "topicId")
    private int id;
    @OneToOne
    @JoinColumn(name = "userId")
    private User author;
    @Column(name = "title")
    private String title;
    @Column(name = "isSolved")
    private Integer isSolved;
    @Column(name = "releaseTime")
    private Date time;
    @Column(name = "solveTime")
    private Date solveTime;
    @Column(name = "kickCount")
    private Integer kickTime;
    @Column(name = "type")
    private Integer type;
    @Column(name = "content")
    private String content;
    @OneToOne
    @JoinColumn(name = "classId")
    private Lesson lesson;
    @OneToMany
    @JoinColumn(name = "topicId")
    @OrderBy("time asc")
    private List<TopicReply> topicReplyList;
    @OneToMany
    @JoinColumn(name = "topicId")
    private List<TopicFile> topicFileList;

    public Topic() {
    }

    public Topic(int id, User author, String title, Integer isSolved, Date time, Date solveTime, Integer kickTime, Integer type, String content, Lesson lesson, List<TopicReply> topicReplyList, List<TopicFile> topicFileList) {
        this.id = id;
        this.author = author;
        this.title = title;
        this.isSolved = isSolved;
        this.time = time;
        this.solveTime = solveTime;
        this.kickTime = kickTime;
        this.type = type;
        this.content = content;
        this.lesson = lesson;
        this.topicReplyList = topicReplyList;
        this.topicFileList = topicFileList;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public User getAuthor() {
        return author;
    }

    public void setAuthor(User author) {
        this.author = author;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Integer getIsSolved() {
        return isSolved;
    }

    public void setIsSolved(Integer isSolved) {
        this.isSolved = isSolved;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public Date getSolveTime() {
        return solveTime;
    }

    public void setSolveTime(Date solveTime) {
        this.solveTime = solveTime;
    }

    public Integer getKickTime() {
        return kickTime;
    }

    public void setKickTime(Integer kickTime) {
        this.kickTime = kickTime;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Lesson getLesson() {
        return lesson;
    }

    public void setLesson(Lesson lesson) {
        this.lesson = lesson;
    }

    public List<TopicReply> getTopicReplyList() {
        return topicReplyList;
    }

    public void setTopicReplyList(List<TopicReply> topicReplyList) {
        this.topicReplyList = topicReplyList;
    }

    public List<TopicFile> getTopicFileList() {
        return topicFileList;
    }

    public void setTopicFileList(List<TopicFile> topicFileList) {
        this.topicFileList = topicFileList;
    }


}
